//
// Created by 汪帅 on 2021/12/28.
//
#include <stdint.h>
#include <stdio.h>
#include <android/log.h>

#define LOGD(x...) do { \
  char buf[512]; \
  sprintf(buf, x); \
  __android_log_print(ANDROID_LOG_DEBUG,"native_add", "%s | %s:%i", buf, __FILE__, __LINE__); \
} while (0)

#define LOGD2(x...) do { \
  char buf[512]; \
  sprintf(buf, x); \
  __android_log_print(ANDROID_LOG_DEBUG,"native_add", "%s", buf); \
} while (0)

#define LOGD3(tag, fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, tag, fmt "\n--> %s\n----> %s:%d", ##__VA_ARGS__, __FILE__, __FUNCTION__, __LINE__)
#define LOGD4(tag, fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, tag, fmt, ##__VA_ARGS__)

extern "C" __attribute__((visibility("default"))) __attribute__((used))
int32_t native_add(int32_t x, int32_t y) {
    int ss= 666;
    printf("%d",ss);

    LOGD("aaaaa");
    LOGD2("aaaaa");
    LOGD3("TAG", "debug message");
    LOGD3("TAG", "%s, %d", "hahahah", ss);
    LOGD4("TAG", "%s, %d", "hahahah", ss);

    return x + y;
}